﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace ApplicationLayer
{
    public class GameDesign
    {
        public GameBoard board = new GameBoard();
        public List<GamePiece> pieces = new List<GamePiece>();
        public int minPlayers;
        public int maxPlayers;
        public bool isDaemonOn;
        public int daemonTimer;
        public int playerTurnTimeLimit;
        public int gameTimeLimit;
        public string name = "";


        public void createOriginalBlokus()
        {
            board.name = "Original";
            board.numColumns = 20;
            board.numRows = 20;
            board.startingCells.Add(new Point(0, 0));
            board.startingCells.Add(new Point(0, 19));
            board.startingCells.Add(new Point(19, 0));
            board.startingCells.Add(new Point(19, 19));

            minPlayers = 4;
            maxPlayers = 4;
            isDaemonOn = false;
            daemonTimer = 0;
            playerTurnTimeLimit = 0;
            gameTimeLimit = 0;

            pieces.Add(new GamePiece(2, 2));
            pieces.Add(new GamePiece(2, 1, 2, 2));
            pieces.Add(new GamePiece(2, 1, 2, 2, 2, 3));
            pieces.Add(new GamePiece(2, 1, 1, 2, 2, 2));
            pieces.Add(new GamePiece(2, 0, 2, 1, 2, 2, 2, 3));
            pieces.Add(new GamePiece(2, 1, 2, 2, 1, 3, 2, 3));
            pieces.Add(new GamePiece(2, 1, 2, 2, 3, 2, 2, 3));
            pieces.Add(new GamePiece(2, 2, 3, 2, 2, 3, 3, 3));
            pieces.Add(new GamePiece(1, 2, 2, 2, 2, 3, 3, 3));

            pieces.Add(new GamePiece(2, 0, 2, 1, 2, 2, 2, 3, 2, 4));
            pieces.Add(new GamePiece(2, 1, 2, 2, 2, 3, 1, 4, 2, 4));
            pieces.Add(new GamePiece(2, 1, 2, 2, 1, 3, 2, 3, 1, 4));
            pieces.Add(new GamePiece(2, 1, 1, 2, 2, 2, 1, 3, 2, 3));
            pieces.Add(new GamePiece(1, 1, 2, 1, 2, 2, 1, 3, 2, 3));
            pieces.Add(new GamePiece(2, 1, 2, 2, 3, 2, 2, 3, 2, 4));
            pieces.Add(new GamePiece(2, 1, 2, 2, 1, 3, 2, 3, 3, 3));
            pieces.Add(new GamePiece(2, 0, 2, 1, 2, 2, 3, 2, 4, 2));
            pieces.Add(new GamePiece(1, 1, 2, 1, 2, 2, 3, 2, 3, 3));
            pieces.Add(new GamePiece(1, 1, 1, 2, 2, 2, 3, 2, 3, 3));
            pieces.Add(new GamePiece(1, 1, 1, 2, 2, 2, 3, 2, 2, 3));
            pieces.Add(new GamePiece(2, 1, 1, 2, 2, 2, 3, 2, 2, 3));

            name = "Original Blokus";
        }
        public void createDoubleBlokus()
        {
            board.name = "Original";
            board.numColumns = 20;
            board.numRows = 20;
            board.startingCells.Add(new Point(0, 0));
            board.startingCells.Add(new Point(0, 19));
            board.startingCells.Add(new Point(19, 0));
            board.startingCells.Add(new Point(19, 19));

            minPlayers = 4;
            maxPlayers = 4;
            isDaemonOn = false;
            daemonTimer = 0;
            playerTurnTimeLimit = 0;
            gameTimeLimit = 0;

            pieces.Add(new GamePiece(2, 2));
            pieces.Add(new GamePiece(2, 1, 2, 2));
            pieces.Add(new GamePiece(2, 1, 2, 2, 2, 3));
            pieces.Add(new GamePiece(2, 1, 1, 2, 2, 2));
            pieces.Add(new GamePiece(2, 0, 2, 1, 2, 2, 2, 3));
            pieces.Add(new GamePiece(2, 1, 2, 2, 1, 3, 2, 3));
            pieces.Add(new GamePiece(2, 1, 2, 2, 3, 2, 2, 3));
            pieces.Add(new GamePiece(2, 2, 3, 2, 2, 3, 3, 3));
            pieces.Add(new GamePiece(1, 2, 2, 2, 2, 3, 3, 3));

            pieces.Add(new GamePiece(2, 0, 2, 1, 2, 2, 2, 3, 2, 4));
            pieces.Add(new GamePiece(2, 1, 2, 2, 2, 3, 1, 4, 2, 4));
            pieces.Add(new GamePiece(2, 1, 2, 2, 1, 3, 2, 3, 1, 4));
            pieces.Add(new GamePiece(2, 1, 1, 2, 2, 2, 1, 3, 2, 3));
            pieces.Add(new GamePiece(1, 1, 2, 1, 2, 2, 1, 3, 2, 3));
            pieces.Add(new GamePiece(2, 1, 2, 2, 3, 2, 2, 3, 2, 4));
            pieces.Add(new GamePiece(2, 1, 2, 2, 1, 3, 2, 3, 3, 3));
            pieces.Add(new GamePiece(2, 0, 2, 1, 2, 2, 3, 2, 4, 2));
            pieces.Add(new GamePiece(1, 1, 2, 1, 2, 2, 3, 2, 3, 3));
            pieces.Add(new GamePiece(1, 1, 1, 2, 2, 2, 3, 2, 3, 3));
            pieces.Add(new GamePiece(1, 1, 1, 2, 2, 2, 3, 2, 2, 3));
            pieces.Add(new GamePiece(2, 1, 1, 2, 2, 2, 3, 2, 2, 3));

            pieces.Add(new GamePiece(2, 2));
            pieces.Add(new GamePiece(2, 1, 2, 2));
            pieces.Add(new GamePiece(2, 1, 2, 2, 2, 3));
            pieces.Add(new GamePiece(2, 1, 1, 2, 2, 2));
            pieces.Add(new GamePiece(2, 0, 2, 1, 2, 2, 2, 3));
            pieces.Add(new GamePiece(2, 1, 2, 2, 1, 3, 2, 3));
            pieces.Add(new GamePiece(2, 1, 2, 2, 3, 2, 2, 3));
            pieces.Add(new GamePiece(2, 2, 3, 2, 2, 3, 3, 3));
            pieces.Add(new GamePiece(1, 2, 2, 2, 2, 3, 3, 3));

            pieces.Add(new GamePiece(2, 0, 2, 1, 2, 2, 2, 3, 2, 4));
            pieces.Add(new GamePiece(2, 1, 2, 2, 2, 3, 1, 4, 2, 4));
            pieces.Add(new GamePiece(2, 1, 2, 2, 1, 3, 2, 3, 1, 4));
            pieces.Add(new GamePiece(2, 1, 1, 2, 2, 2, 1, 3, 2, 3));
            pieces.Add(new GamePiece(1, 1, 2, 1, 2, 2, 1, 3, 2, 3));
            pieces.Add(new GamePiece(2, 1, 2, 2, 3, 2, 2, 3, 2, 4));
            pieces.Add(new GamePiece(2, 1, 2, 2, 1, 3, 2, 3, 3, 3));
            pieces.Add(new GamePiece(2, 0, 2, 1, 2, 2, 3, 2, 4, 2));
            pieces.Add(new GamePiece(1, 1, 2, 1, 2, 2, 3, 2, 3, 3));
            pieces.Add(new GamePiece(1, 1, 1, 2, 2, 2, 3, 2, 3, 3));
            pieces.Add(new GamePiece(1, 1, 1, 2, 2, 2, 3, 2, 2, 3));
            pieces.Add(new GamePiece(2, 1, 1, 2, 2, 2, 3, 2, 2, 3));

            name = "Double Blokus";
        }
        public GameDesign getCopy()
        {
            GameDesign gd = new GameDesign();
            gd.board = this.board.getCopy();
            foreach (GamePiece p in this.pieces)
                gd.pieces.Add(p.getCopy());
            gd.minPlayers = this.minPlayers;
            gd.maxPlayers = this.maxPlayers;
            gd.isDaemonOn = this.isDaemonOn;
            gd.playerTurnTimeLimit = this.playerTurnTimeLimit;
            gd.gameTimeLimit = this.gameTimeLimit;
            gd.name = this.name;
            return gd;
        }       
    }
}
